GREG2JUL

The GREG2JUL function calculates the Julian Date (which begins at noon) for the specified Gregorian date. This is the inverse of the JUL2GREG procedure.

Notes

Examples

Print out all of the "special" leap days between 1 C.E. and the present:

PRINT, GREG2JUL(2,29,400), GREG2JUL(2,29,800), GREG2JUL(2,29,1200), $

  GREG2JUL(2,29,1600), GREG2JUL(2,29,2000)

IDL prints:

1867216  2013313   2159410   2305507   2451604

Using arrays, this can also be calculated as follows:

PRINT, GREG2JUL(2,29,[400,800,1200,1600,2000])

As another example, print the number of days between 17 January 1850 and 1 January 850:

PRINT, GREG2JUL(1,17,1850) - GREG2JUL(1,1,850)

IDL prints:

365258

Syntax

Result = GREG2JUL(Month, Day, Year, Hour, Minute, Second [, /MODIFIED])

Return Value

Result is of type double-precision if Hour, Minute, or Second is specified, otherwise Result is of type long integer. If all arguments are scalars, the function returns a scalar. If all arguments are arrays, the function matches up the corresponding elements of the arrays, returning an array with the same dimensions as the smallest array. If the inputs contain both scalars and arrays, the function uses the scalar value with each element of the arrays, and returns an array with the same dimensions as the smallest input array.

Arguments

If no arguments are given then the Julian date corresponding to the current system time is returned.

Month

Number of the month (1 = January, ..., 12 = December). Month can be either a scalar or an array.

Day

Number of the day of the month (1-31). Day can be either a scalar or an array.

Year

Number of the year (e.g., 1994). Year can be either a scalar or an array.

Hour

Number of the hour of the day (0-23). Hour can be either a scalar or an array.

Minute

Number of the minute of the hour (0-59). Minute can be either a scalar or an array.

Second

Number of the second of the minute (0-59). Second can be either a scalar or an array.

Keywords

MODIFIED

Set this keyword to return the Modified Julian Date, which is the regular Julian Date minus 2400000.5. Modified Julian Dates have a precision of approximately 1.2x10–11 (equal to 1x10–6 seconds).

Note: When converting Modified Julian Dates to and from date/times, be sure to specify the MODIFIED keyword on all calls to GREG2JUL and JUL2GREG.

Version History

8.2.1

Introduced

8.8.3 Added MODIFIED keyword

See Also

CALDAT, JUL2GREG, JULDAY, SYSTIME, Date/Time Data